﻿@{
    ViewBag.Title = "advanceSearch";
}

<div id="cphMain_ctl00_ContentPane" class="center">
        <div id="Breadcrumb" class="Breadcrumb">
        <ul>
            <li class="first">
                <a href='javascript:;' onclick="javascript:loadAction('Index2','Main')">Trang chủ
                </a>
            </li>
            <li>
                <a href='javascript:;' onclick="javascript:loadAction('show2','Main')">Sản phẩm</a>
            </li>
            <li>
                <span>Tìm kiếm nâng cao</span>
            </li>
        </ul>
    </div>
    <form action="/Main/advanceSearchClick" method="post">
<div id="Advance-Search" class="Advance-Search DefaultModule">
    <div class="defaultTitle AdvanceSearch-Title">
        <span>
            Tìm kiếm nâng cao</span></div>
    <div class="defaultContent AdvanceSearch-content">
        <div id="SearchPageHeader" class="Block Moveable Panel">
            <div class="BlockContent">
                <div style="">
                    <div class="AdvanceSearch">
                        <h3 class="Clear" style="">
                            Thông tin tìm kiếm</h3>
                        <div class="FormContainer HorizontalFormContainer NarrowFormContainer PL20">
                            <dl>
                                <dt>Từ khóa:</dt>
                                <dd>
                                    <input name="key" type="text" id="cphMain_ctl00_ctl01_ctl00_txtKeywords" class="NormalTextBox" style="width:350px;">
                                </dd>
                                
                                <dt>Danh mục:</dt>
                                <dd>
                                    <div id="category" class="ISSelect Field250 ISSelectReplacement ISSelectAlreadyReplaced" style="height: 150px; width: 300px;">
                                        <ul>
                                            @foreach (var cate in ViewBag.categoryList2)
                                            {
                                                string input_id = "check" + cate.Key;    
                                                <li class="">
                                                        <label>
                                                            
                                                            <input id="@input_id" type="checkbox" value="@cate.Key" onclick="javascript:ClickCategory(@cate.Key);">
                                                            
                                                            @ViewBag.categoryList2Name[cate.Key]
                                                        </label>
                                                        <ul>        
                                                            @foreach(var group in cate.Value)
                                                            {
                                                                string groupName = "check2" + group;    
                                                                <li>
                                                                        <label>
                                                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                            <input id="@groupName" type="checkbox" value="@group" onclick="javascript:ClickGroup('@(group)');">
                                                                            @group
                                                                        </label>
                                                                        <ul>
                                                                            
                                                                        </ul>
                                                                    </li>
                                                            }   
                                                                                                                            
                                                        </ul>
                                                    </li>
                                            }                                                                                                                          
                                                
                                        </ul>
                                    </div>
                                </dd>
                                <dt></dt>
                                <dd>                                    
                                </dd>
                            </dl>
                            <hr>
                        </div>
                        <h3 class="Clear" style="">
                            Tìm theo giá</h3>
                        <div class="FormContainer HorizontalFormContainer NarrowFormContainer PL20">
                            <dl>
                                <dt>Khoảng giá:</dt>
                                <dd>
                                    Từ
                                    <input name="fromPrice" type="text" id="fromPrice" class="NormalTextBox" style="width:70px;">
                                    đến
                                    <input name="toPrice" type="text" id="toPrice" class="NormalTextBox" style="width:70px;">
                                </dd>
                            </dl>
                            <hr>
                        </div>

                        <dl>
                            <dt></dt>
                            <dd>
                                <input type="submit" name="ctl00$cphMain$ctl00$ctl01$ctl00$btnSearch" value="Tìm kiếm" id="cphMain_ctl00_ctl01_ctl00_btnSearch">
                            </dd>
                        </dl>
                    </div>
                </div>
            </div>
            <br class="Clear">
        </div>
    </div>
    <div class="clear defaultFooter AdvanceSearch-footer">
        <div></div>
    </div>
</div>
<input type="hidden" name="categoriesIDList" id="categoriesIDList" value="">
        <input type="hidden" name="groupList" id="groupList" value="">
        <input type="hidden" name="advance" value="advance" />
        </form>
<script type="text/javascript">
    function ClickCategory(id) {  var objCb = document.getElementById("check" + id); var objHd = document.getElementById('categoriesIDList'); if (objCb.checked == true) { objHd.value = objHd.value + id + ","; } else { objHd.value = objHd.value.replace(id + ",", ""); } }
    
    
    function ClickGroup(name) { 
        
        var objCb = document.getElementById("check2" + name); 
        var objHd = document.getElementById('groupList'); 
        if (objCb.checked == true) { 
            objHd.value = objHd.value + name + ","; 
        } else { 
            objHd.value = objHd.value.replace(name + ",", ""); 
        } 
    }
    
function ClickSearch() { var key = $j("[id$='txtKeywords']").val(); if (key == "") { alert('Bạn phải nhập từ khóa tìm kiếm !'); $j("[id$='txtKeywords']").focus(); return false; } return true; }
</script>

</div>
